package com.sskj.hhhjys;

import com.lzy.okgo.model.Response;
import com.sskj.common.base.HttpData;
import com.sskj.hhhjys.http.HttpConfig;
import com.sskj.hhhjys.presenter.BasePresenter;
import com.sskj.hhhjys.MarketDetailActivity;
import com.sskj.lib.bean.CoinBean;
import com.sskj.lib.http.JsonCallBack;

import java.util.List;


/**
 * @author Hey
 * Create at  2019/05/10
 */
class MarketDetailPresenter extends BasePresenter<MarketDetailActivity> {
    public void getData(String code) {
        httpService.getProduct(code)
                .execute(new JsonCallBack<HttpData<List<CoinBean>>>() {
                    @Override
                    public void onSuccess(Response<HttpData<List<CoinBean>>> response) {
                        HttpData<List<CoinBean>> httpData = response.body();
                        if (httpData.getStatus() == HttpConfig.OK) {

                            mView.updateUI(httpData.getData().get(0));
                        }
                    }
                });
    }
}
